package cn.javass.dp.chianofresponsibility.example5;

/**
 * 职责链接口 也就是处理请求的接口
 */
public abstract class Handle {

    /**
     * 持有后继的职责对象
     */
    protected Handle successor;

    public void setSuccessor(Handle successor) {
        this.successor = successor;
    }

    /**
     * 通用请求对象
     * @param rm
     * @return
     */
    public Object handleRequest(RequestModel rm) {
        if (successor != null) {
            return this.successor.handleRequest(rm);
        } else {
            System.out.println("没有后续处理功能");
            return false;
        }
    }
}
